In [5]:
import os, sys

import lasio

In [6]:
def print2(msg):
    for i, line in enumerate(msg.splitlines()):
        print "Line %d:%s" % (i, line.strip("\n"))

In [7]:
l = lasio.read(os.path.join("..", "tests", "examples", "1.2", "sample_wrapped.las"))
print2(l._text)


Line 0:~Version Information
Line 1: VERS.                1.20:   CWLS log ASCII Standard -VERSION 1.20
Line 2: WRAP.                 YES:   Multiple lines per depth step
Line 3:~Well Information
Line 4:#MNEM.UNIT       Data Type    Information
Line 5:#---------    -------------   ------------------------------
Line 6: STRT.M            910.000:
Line 7: STOP.M            901.000:
Line 8: STEP.M            -0.1250:
Line 9: NULL.           -999.2500:   Null value
Line 10: COMP.             COMPANY:   ANY OIL COMPANY INC.
Line 11: WELL.                WELL:   ANY ET AL XX-XX-XX-XX
Line 12: FLD .               FIELD:   WILDCAT
Line 13: LOC .            LOCATION:   XX-XX-XX-XXW3M
Line 14: PROV.            PROVINCE:   SASKATCHEWAN
Line 15: SRVC.     SERVICE COMPANY:   ANY LOGGING COMPANY INC.
Line 16: SON .     SERVICE ORDER :   142085
Line 17: DATE.            LOG DATE:   13-DEC-86
Line 18: UWI .      UNIQUE WELL ID:
Line 19:~Curve Information
Line 20:#MNEM.UNIT      API CODE      Curve Description
Line 21:#---------    -------------   ------------------------------
Line 22: DEPT.M                       :    Depth
Line 23: DT  .US/M                    :  1 Sonic Travel Time
Line 24: RHOB.K/M                     :  2 Density-Bulk Density
Line 25: NPHI.V/V                     :  3 Porosity -Neutron
Line 26: RX0 .OHMM                    :  4 Resistivity -Rxo
Line 27: RESS.OHMM                    :  5 Resistivity -Shallow
Line 28: RESM.OHMM                    :  6 Resistivity -Medium
Line 29: RESD.OHMM                    :  7 Resistivity -Deep
Line 30: SP  .MV                      :  8 Spon. Potential
Line 31: GR  .GAPI                    :  9 Gamma Ray
Line 32: CALI.MM                      : 10 Caliper
Line 33: DRHO.K/M3                    : 11 Delta-Rho
Line 34: EATT.DBM                     : 12 EPT Attenuation
Line 35: TPL .NS/M                    : 13 TP -EPT
Line 36: PEF .                        : 14 PhotoElectric Factor
Line 37: FFI .V/V                     : 15 Porosity -NML FFI
Line 38: DCAL.MM                      : 16 Caliper-Differential
Line 39: RHGF.K/M3                    : 17 Density-Formation
Line 40: RHGA.K/M3                    : 18 Density-Apparent
Line 41: SPBL.MV                      : 19 Baselined SP
Line 42: GRC .GAPI                    : 20 Gamma Ray BHC
Line 43: PHIA.V/V                     : 21 Porosity -Apparent
Line 44: PHID.V/V                     : 22 Porosity -Density
Line 45: PHIE.V/V                     : 23 Porosity -Effective
Line 46: PHIN.V/V                     : 24 Porosity -Neut BHC
Line 47: PHIC.V/V                     : 25 Porosity -Total HCC
Line 48: R0  .OHMM                    : 26 Ro
Line 49: RWA .OHMM                    : 27 Rfa
Line 50: SW   .                       : 28 Sw -Effective
Line 51: MSI .                        : 29 Sh Idx -Min
Line 52: BVW .                        : 30 BVW
Line 53: FGAS.                        : 31 Flag -Gas Index
Line 54: PIDX.                        : 32 Prod Idx
Line 55: FBH .                        : 33 Flag -Bad Hole
Line 56: FHCC.                        : 34 Flag -HC Correction
Line 57: LSWB.                        : 35 Flag -Limit SWB
Line 58:~A Log data section
Line 59:910.000000
Line 60:  -999.2500  2692.7075     0.3140    19.4086    19.4086    13.1709    12.2681
Line 61:    -1.5010    96.5306   204.7177    30.5822  -999.2500  -999.2500     3.2515
Line 62:  -999.2500     4.7177  3025.0264  3025.0264    -1.5010    93.1378     0.1641
Line 63:     0.0101     0.1641     0.3140     0.1641    11.1397     0.3304     0.9529
Line 64:     0.0000     0.1564     0.0000    11.1397     0.0000     0.0000     0.0000
Line 65:909.875000
Line 66:  -999.2500  2712.6460     0.2886    23.3987    23.3987    13.6129    12.4744
Line 67:    -1.4720    90.2803   203.1093    18.7566  -999.2500  -999.2500     3.7058
Line 68:  -999.2500     3.1093  3004.6050  3004.6050    -1.4720    86.9078     0.1456
Line 69:    -0.0015     0.1456     0.2886     0.1456    14.1428     0.2646     1.0000
Line 70:     0.0000     0.1456     0.0000    14.1428     0.0000     0.0000     0.0000
Line 71:909.750000
Line 72:  -999.2500  2692.8137     0.2730    22.5909    22.5909    13.6821    12.6146
Line 73:    -1.4804    89.8492   201.9287     3.1551  -999.2500  -999.2500     4.3124
Line 74:  -999.2500     1.9287  2976.4451  2976.4451    -1.4804    86.3465     0.1435
Line 75:     0.0101     0.1435     0.2730     0.1435    14.5674     0.2598     1.0000
Line 76:     0.0000     0.1435     0.0000    14.5674     0.0000     0.0000     0.0000
Line 77:909.625000
Line 78:  -999.2500  2644.3650     0.2765    18.4831    18.4831    13.4159    12.6900
Line 79:    -1.5010    93.3999   201.5826    -6.5861  -999.2500  -999.2500     4.3822
Line 80:  -999.2500     1.5826  2955.3528  2955.3528    -1.5010    89.7142     0.1590
Line 81:     0.0384     0.1590     0.2765     0.1590    11.8600     0.3210     0.9667
Line 82:     0.0000     0.1538     0.0000    11.8600     0.0000     0.0000     0.0000
Line 83:909.500000
Line 84:  -999.2500  2586.2822     0.2996    13.9187    13.9187    12.9195    12.7016
Line 85:    -1.4916    98.1214   201.7126    -4.5574  -999.2500  -999.2500     3.5967
Line 86:  -999.2500     1.7126  2953.5940  2953.5940    -1.4916    94.2670     0.1880
Line 87:     0.0723     0.1880     0.2996     0.1880     8.4863     0.4490     0.8174
Line 88:     0.0000     0.1537     0.0000     8.4863     0.0000     0.0000     0.0000

Show an unwrapped version


In [10]:
print l.version["WRAP"]
print
s = lasio.las.StringIO()
l.write(s, version=2, fmt="%.5f")
s.seek(0)
print2(s.read())


HeaderItem(mnemonic='WRAP', unit='', value='YES', descr='Multiple lines per depth step')

Line 0:~Version ---------------------------------------------------
Line 1:VERS.     2.0 : CWLS log ASCII Standard -VERSION 2.0
Line 2:WRAP.     YES : Multiple lines per depth step
Line 3:~Well ------------------------------------------------------
Line 4:STRT.M                       910.0 : 
Line 5:STOP.M                       909.5 : 
Line 6:STEP.M                      -0.125 : 
Line 7:NULL.                      -999.25 : Null value
Line 8:COMP.         ANY OIL COMPANY INC. : COMPANY
Line 9:WELL.        ANY ET AL XX-XX-XX-XX : WELL
Line 10:FLD .                      WILDCAT : FIELD
Line 11:LOC .               XX-XX-XX-XXW3M : LOCATION
Line 12:PROV.                 SASKATCHEWAN : PROVINCE
Line 13:SRVC.     ANY LOGGING COMPANY INC. : SERVICE COMPANY
Line 14:SON .                       142085 : SERVICE ORDER
Line 15:DATE.                    13-DEC-86 : LOG DATE
Line 16:UWI .                              : UNIQUE WELL ID
Line 17:~Curves ----------------------------------------------------
Line 18:DEPT.M         : Depth
Line 19:DT  .US/M      : 1 Sonic Travel Time
Line 20:RHOB.K/M       : 2 Density-Bulk Density
Line 21:NPHI.V/V       : 3 Porosity -Neutron
Line 22:RX0 .OHMM      : 4 Resistivity -Rxo
Line 23:RESS.OHMM      : 5 Resistivity -Shallow
Line 24:RESM.OHMM      : 6 Resistivity -Medium
Line 25:RESD.OHMM      : 7 Resistivity -Deep
Line 26:SP  .MV        : 8 Spon. Potential
Line 27:GR  .GAPI      : 9 Gamma Ray
Line 28:CALI.MM        : 10 Caliper
Line 29:DRHO.K/M3      : 11 Delta-Rho
Line 30:EATT.DBM       : 12 EPT Attenuation
Line 31:TPL .NS/M      : 13 TP -EPT
Line 32:PEF .          : 14 PhotoElectric Factor
Line 33:FFI .V/V       : 15 Porosity -NML FFI
Line 34:DCAL.MM        : 16 Caliper-Differential
Line 35:RHGF.K/M3      : 17 Density-Formation
Line 36:RHGA.K/M3      : 18 Density-Apparent
Line 37:SPBL.MV        : 19 Baselined SP
Line 38:GRC .GAPI      : 20 Gamma Ray BHC
Line 39:PHIA.V/V       : 21 Porosity -Apparent
Line 40:PHID.V/V       : 22 Porosity -Density
Line 41:PHIE.V/V       : 23 Porosity -Effective
Line 42:PHIN.V/V       : 24 Porosity -Neut BHC
Line 43:PHIC.V/V       : 25 Porosity -Total HCC
Line 44:R0  .OHMM      : 26 Ro
Line 45:RWA .OHMM      : 27 Rfa
Line 46:SW  .          : 28 Sw -Effective
Line 47:MSI .          : 29 Sh Idx -Min
Line 48:BVW .          : 30 BVW
Line 49:FGAS.          : 31 Flag -Gas Index
Line 50:PIDX.          : 32 Prod Idx
Line 51:FBH .          : 33 Flag -Bad Hole
Line 52:FHCC.          : 34 Flag -HC Correction
Line 53:LSWB.          : 35 Flag -Limit SWB
Line 54:~Params ----------------------------------------------------
Line 55:~Other -----------------------------------------------------
Line 56:~ASCII -----------------------------------------------------
Line 57:  910.00000    -999.25 2692.70750    0.31400   19.40860   19.40860   13.17090
Line 58:12.26810   -1.50100   96.53060  204.71770   30.58220    -999.25    -999.25
Line 59:3.25150    -999.25    4.71770 3025.02640 3025.02640   -1.50100   93.13780
Line 60:0.16410    0.01010    0.16410    0.31400    0.16410   11.13970    0.33040
Line 61:0.95290    0.00000    0.15640    0.00000   11.13970    0.00000    0.00000
Line 62:0.00000
Line 63:  909.87500    -999.25 2712.64600    0.28860   23.39870   23.39870   13.61290
Line 64:12.47440   -1.47200   90.28030  203.10930   18.75660    -999.25    -999.25
Line 65:3.70580    -999.25    3.10930 3004.60500 3004.60500   -1.47200   86.90780
Line 66:0.14560   -0.00150    0.14560    0.28860    0.14560   14.14280    0.26460
Line 67:1.00000    0.00000    0.14560    0.00000   14.14280    0.00000    0.00000
Line 68:0.00000
Line 69:  909.75000    -999.25 2692.81370    0.27300   22.59090   22.59090   13.68210
Line 70:12.61460   -1.48040   89.84920  201.92870    3.15510    -999.25    -999.25
Line 71:4.31240    -999.25    1.92870 2976.44510 2976.44510   -1.48040   86.34650
Line 72:0.14350    0.01010    0.14350    0.27300    0.14350   14.56740    0.25980
Line 73:1.00000    0.00000    0.14350    0.00000   14.56740    0.00000    0.00000
Line 74:0.00000
Line 75:  909.62500    -999.25 2644.36500    0.27650   18.48310   18.48310   13.41590
Line 76:12.69000   -1.50100   93.39990  201.58260   -6.58610    -999.25    -999.25
Line 77:4.38220    -999.25    1.58260 2955.35280 2955.35280   -1.50100   89.71420
Line 78:0.15900    0.03840    0.15900    0.27650    0.15900   11.86000    0.32100
Line 79:0.96670    0.00000    0.15380    0.00000   11.86000    0.00000    0.00000
Line 80:0.00000
Line 81:  909.50000    -999.25 2586.28220    0.29960   13.91870   13.91870   12.91950
Line 82:12.70160   -1.49160   98.12140  201.71260   -4.55740    -999.25    -999.25
Line 83:3.59670    -999.25    1.71260 2953.59400 2953.59400   -1.49160   94.26700
Line 84:0.18800    0.07230    0.18800    0.29960    0.18800    8.48630    0.44900
Line 85:0.81740    0.00000    0.15370    0.00000    8.48630    0.00000    0.00000
Line 86:0.00000

Write un-wrapped version:


In [11]:
l.version["WRAP"].value = "NO"
print l.version["WRAP"]
print
s = lasio.las.StringIO()
l.write(s, version=2, fmt="%.5f")
s.seek(0)
print2(s.read())


HeaderItem(mnemonic='WRAP', unit='', value='NO', descr='Multiple lines per depth step')

Line 0:~Version ---------------------------------------------------
Line 1:VERS.     2.0 : CWLS log ASCII Standard -VERSION 2.0
Line 2:WRAP.      NO : Multiple lines per depth step
Line 3:~Well ------------------------------------------------------
Line 4:STRT.M                       910.0 : 
Line 5:STOP.M                       909.5 : 
Line 6:STEP.M                      -0.125 : 
Line 7:NULL.                      -999.25 : Null value
Line 8:COMP.         ANY OIL COMPANY INC. : COMPANY
Line 9:WELL.        ANY ET AL XX-XX-XX-XX : WELL
Line 10:FLD .                      WILDCAT : FIELD
Line 11:LOC .               XX-XX-XX-XXW3M : LOCATION
Line 12:PROV.                 SASKATCHEWAN : PROVINCE
Line 13:SRVC.     ANY LOGGING COMPANY INC. : SERVICE COMPANY
Line 14:SON .                       142085 : SERVICE ORDER
Line 15:DATE.                    13-DEC-86 : LOG DATE
Line 16:UWI .                              : UNIQUE WELL ID
Line 17:~Curves ----------------------------------------------------
Line 18:DEPT.M         : Depth
Line 19:DT  .US/M      : 1 Sonic Travel Time
Line 20:RHOB.K/M       : 2 Density-Bulk Density
Line 21:NPHI.V/V       : 3 Porosity -Neutron
Line 22:RX0 .OHMM      : 4 Resistivity -Rxo
Line 23:RESS.OHMM      : 5 Resistivity -Shallow
Line 24:RESM.OHMM      : 6 Resistivity -Medium
Line 25:RESD.OHMM      : 7 Resistivity -Deep
Line 26:SP  .MV        : 8 Spon. Potential
Line 27:GR  .GAPI      : 9 Gamma Ray
Line 28:CALI.MM        : 10 Caliper
Line 29:DRHO.K/M3      : 11 Delta-Rho
Line 30:EATT.DBM       : 12 EPT Attenuation
Line 31:TPL .NS/M      : 13 TP -EPT
Line 32:PEF .          : 14 PhotoElectric Factor
Line 33:FFI .V/V       : 15 Porosity -NML FFI
Line 34:DCAL.MM        : 16 Caliper-Differential
Line 35:RHGF.K/M3      : 17 Density-Formation
Line 36:RHGA.K/M3      : 18 Density-Apparent
Line 37:SPBL.MV        : 19 Baselined SP
Line 38:GRC .GAPI      : 20 Gamma Ray BHC
Line 39:PHIA.V/V       : 21 Porosity -Apparent
Line 40:PHID.V/V       : 22 Porosity -Density
Line 41:PHIE.V/V       : 23 Porosity -Effective
Line 42:PHIN.V/V       : 24 Porosity -Neut BHC
Line 43:PHIC.V/V       : 25 Porosity -Total HCC
Line 44:R0  .OHMM      : 26 Ro
Line 45:RWA .OHMM      : 27 Rfa
Line 46:SW  .          : 28 Sw -Effective
Line 47:MSI .          : 29 Sh Idx -Min
Line 48:BVW .          : 30 BVW
Line 49:FGAS.          : 31 Flag -Gas Index
Line 50:PIDX.          : 32 Prod Idx
Line 51:FBH .          : 33 Flag -Bad Hole
Line 52:FHCC.          : 34 Flag -HC Correction
Line 53:LSWB.          : 35 Flag -Limit SWB
Line 54:~Params ----------------------------------------------------
Line 55:~Other -----------------------------------------------------
Line 56:~ASCII -----------------------------------------------------
Line 57:  910.00000    -999.25 2692.70750    0.31400   19.40860   19.40860   13.17090   12.26810   -1.50100   96.53060  204.71770   30.58220    -999.25    -999.25    3.25150    -999.25    4.71770 3025.02640 3025.02640   -1.50100   93.13780    0.16410    0.01010    0.16410    0.31400    0.16410   11.13970    0.33040    0.95290    0.00000    0.15640    0.00000   11.13970    0.00000    0.00000    0.00000
Line 58:  909.87500    -999.25 2712.64600    0.28860   23.39870   23.39870   13.61290   12.47440   -1.47200   90.28030  203.10930   18.75660    -999.25    -999.25    3.70580    -999.25    3.10930 3004.60500 3004.60500   -1.47200   86.90780    0.14560   -0.00150    0.14560    0.28860    0.14560   14.14280    0.26460    1.00000    0.00000    0.14560    0.00000   14.14280    0.00000    0.00000    0.00000
Line 59:  909.75000    -999.25 2692.81370    0.27300   22.59090   22.59090   13.68210   12.61460   -1.48040   89.84920  201.92870    3.15510    -999.25    -999.25    4.31240    -999.25    1.92870 2976.44510 2976.44510   -1.48040   86.34650    0.14350    0.01010    0.14350    0.27300    0.14350   14.56740    0.25980    1.00000    0.00000    0.14350    0.00000   14.56740    0.00000    0.00000    0.00000
Line 60:  909.62500    -999.25 2644.36500    0.27650   18.48310   18.48310   13.41590   12.69000   -1.50100   93.39990  201.58260   -6.58610    -999.25    -999.25    4.38220    -999.25    1.58260 2955.35280 2955.35280   -1.50100   89.71420    0.15900    0.03840    0.15900    0.27650    0.15900   11.86000    0.32100    0.96670    0.00000    0.15380    0.00000   11.86000    0.00000    0.00000    0.00000
Line 61:  909.50000    -999.25 2586.28220    0.29960   13.91870   13.91870   12.91950   12.70160   -1.49160   98.12140  201.71260   -4.55740    -999.25    -999.25    3.59670    -999.25    1.71260 2953.59400 2953.59400   -1.49160   94.26700    0.18800    0.07230    0.18800    0.29960    0.18800    8.48630    0.44900    0.81740    0.00000    0.15370    0.00000    8.48630    0.00000    0.00000    0.00000

In [ ]: